{% extends "base.html" %}
{% block page %}
    <div class="div"><p>热点业务信息</p></div>
    {% if id  %}
        <a href="#" style="float: left" onclick="referrer_url()"><span class="icon-hand-left"></span>返回</a>
        <div style="clear:both"><div class="style_hr"></div></div>
        {% if business_info %}
            <div class="table table-striped table-bordered table-condensed" style="margin-left:3%;width: 93%">
                <div class="table-responsive" >
                    <strong style="float:left;margin-left: 1%;">业务信息:</strong>
                    <table class="table">
                        <thead>
                            <tr>
                                {% for t in business_info[0] %}
                                    <th style="text-align: center;vertical-align: middle;">{{ t }}</th>
                                {% endfor %}
                            </tr>
                        </thead>
                        <tbody>
                            {% for values in business_info[1:] %}
                                <tr>
                                    <td style="text-align: center;vertical-align: middle">
                                        {% if '.jar' in values[0] %}
                                            <a href="/run_jar/{{ values[0] }}">{{ values[0] }}</a>
                                        {% else %}
                                            <a href="/resource_pool?project={{ values[0] }}">{{ values[0] }}</a>
                                        {% endif %}
                                    </td>
                                    <td style="text-align: center;vertical-align: middle">
                                        {% if values[1] %}
                                            {% set lists = values[1].split(',') %}
                                            {% for v in lists %}
                                                <a href="#" onclick="select_host_set_cookies('{{ v }}','/chart_business_bigdata')">{{ v }}</a>&nbsp;&nbsp;
                                            {% endfor %}
                                        {% else %}
                                            {{ values[1] }}
                                        {% endif %}
                                    </td>
                                    {% for val in values[2:] %}
                                        <td style="text-align: center;vertical-align: middle">{{ val }}</td>
                                    {% endfor %}
                                </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>
            </div>
            {% if busi_counts %}
                <div class="table table-striped table-bordered table-condensed" style="margin-left:3%;width: 93%">
                    <div class="table-responsive" >
                        <strong style="float:left;margin-left: 1%;"><span style="color: blue">{{ business_info[1][2] }}业务</span>web性能指标:</strong>
                        <table class="table">
                            <thead>
                                <tr>
                                    {% for t in busi_tables %}
                                        <th style="text-align: center;vertical-align: middle;">{{ t }}</th>
                                    {% endfor %}
                                </tr>
                            </thead>
                            <tbody>
                                {% for key in busi_counts %}
                                    <tr>
                                        <td style="text-align: center;vertical-align: middle">{{ key }}</td>
                                        {% for val in busi_counts[key] %}
                                            <td style="text-align: center;vertical-align: middle">{{ val }}</td>
                                        {% endfor %}
                                    </tr>
                                {% endfor %}
                            </tbody>
                        </table>
                    </div>
                </div>
            {% endif %}
        {% endif %}
        {% if values %}
            <div style="margin-left: 1%">
                {% if values['idc'] and values['idc_lists'] %}
                    <div ID="idc_chart" style="border: 2px solid;border-color:#ebeef0;float: left;width: 46%;margin-left: 2%;overflow: hidden;;height:330px">
                        <strong><span style="color: blue">{{ business_info[1][2] }}业务</span>机房服务器分布统计</strong>
                        <a href="#" onclick="select_chart_list('idc_chart')"><i class="fas fa-list-ul"></i></a>
                        {{ echarts_js_dependencies(values['idc']) }}
                        {{ echarts_container(values['idc']) }}
                        {{ echarts_js_content(values['idc']) }}
                    </div>
                    <div ID="idc_list" style="float:left;margin-left: 2%;width:46%;height:330px;border:1px solid gainsboro;overflow: scroll;display: none;">
                        <span style="text-align: center">
                            <strong><span style="color: blue">{{ business_info[1][2] }}业务</span>机房服务器分布统计</strong>
                        </span>
                        <a href="#" onclick="select_chart_list('idc_list')"><i class="fas fa-chart-pie"></i></a>
                        <table class="table table-striped table-bordered">
                            <thead>
                                <tr>
                                    <th style="text-align: center;vertical-align: middle;;width:45%">机房</th>
                                    <th style="text-align: center;vertical-align: middle;;width:45%">服务器数量</th>
                                </tr>
                            </thead>
                            <tbody>
                                {% for info in values['idc_lists'][:-1] %}
                                    <tr>
                                        <td style="text-align: center;vertical-align: middle">{{ info[0] }}</td>
                                        <td style="text-align: center;vertical-align: middle">
                                            <a href="/assets_deploy/business/{{ business_info[1][2] }}/{{ info[0] }}">{{ info[1] }}</a>
                                        </td>
                                    </tr>
                                {% endfor %}
                                 <tr>
                                        <td style="text-align: center;vertical-align: middle">{{ values['idc_lists'][-1][0] }}</td>
                                        <td style="text-align: center;vertical-align: middle">
                                            <a href="/assets_deploy/business/{{ business_info[1][2] }}">{{ values['idc_lists'][-1][1] }}</a>
                                        </td>
                                 </tr>
                            </tbody>
                        </table>
                    </div>
                {% endif %}
                {% if values['app'] and values['app_lists'] %}
                    <div ID="app_chart" style="border: 2px solid;border-color:#ebeef0;float: left;width: 46%;margin-left:2%;overflow: hidden;;height:330px">
                        <strong><span style="color: blue">{{ business_info[1][2] }}业务</span>应用服务资源统计</strong>
                        <a href="#" onclick="select_chart_list('app_chart')"><i class="fas fa-list-ul"></i></a>
                        {{ echarts_js_dependencies(values['app']) }}
                        {{ echarts_container(values['app']) }}
                        {{ echarts_js_content(values['app']) }}
                    </div>
                    <div ID="app_list" style="float:left;margin-left: 2%;width:46%;height:330px;border:1px solid gainsboro;overflow: scroll;display: none">
                        <span style="text-align: center"><strong><span style="color: blue">{{ business_info[1][2] }}业务</span>应用服务资源统计</strong></span>
                        <a href="#" onclick="select_chart_list('app_list')"><i class="fas fa-chart-pie"></i></a>
                        <table class="table table-striped table-bordered">
                            <thead>
                                <tr>
                                    <th style="text-align: center;vertical-align: middle;width:45%">应用服务</th>
                                    <th style="text-align: center;vertical-align: middle;width:45%">应用实例数量</th>
                                </tr>
                            </thead>
                            <tbody>
                                {% for info in values['app_lists'][:-1] %}
                                    <tr>
                                        <td style="text-align: center;vertical-align: middle">{{ info[0] }}</td>
                                        <td style="text-align: center;vertical-align: middle">
                                            <a href="/resource_query/{{ business_info[1][2] }}/{{ info[0] }}">{{ info[1] }}</a>
                                        </td>
                                    </tr>
                                {% endfor %}
                            </tbody>
                        </table>
                    </div>
                {% endif %}
            </div>
        {% endif %}
    {% else %}
        <div style="clear:both"><div class="style_hr"></div></div>
        <div style="width: 99%;">
            {% for val in values['business'] %}
                <div class="business"><a href="/business/{{ val[0] }}" title="{{ val[-1] }}")>{{ val[1] }}</a></div>
            {% endfor %}
        </div>
        <div style="clear:both;margin-top: 1%"><br><div class="style_hr"></div></div>
        <div style="width:99%;margin-top: 1%;">
            <div style="margin-left: -9%;">
                {{ echarts_js_dependencies(bar) }}
                {{ echarts_container(bar) }}
                {{ echarts_js_content(bar) }}
            </div>
        </div>
    {% endif %}
    <div style="clear:both"></div>
    <div style="margin-top: 1%" ><div class="style_hr"></div></div>
{% endblock page %}